package practice.unionfind;

/**
 * @Description:
 * @Author Ammar
 * @Create 2023/8/26 20:37
 */
public class QuickUnion_rank_spliting extends QuickUnion_rank {
    public QuickUnion_rank_spliting(int capacity) {
        super(capacity);
    }

    @Override
    public int find(int v) {
        rangeCheck(v);
        while (v != parent[v]) {
            int p = parent[v];
            parent[v] = parent[parent[v]];
            v = p;
        }
        return v;
    }
}
